﻿using System.Web.Mvc;

namespace KolhozWeb
{
    public static class Html
    {
        public static MvcHtmlString CheckBoxEx(this HtmlHelper helper, string name, string id, bool value,
            string ajaxUrl, MvcHtmlString text)
        {
            var checkBoxStr = string.Format("<input type='checkbox' name='{0}' id='{1}' checked='{2}' data-url='{3}' itemid='{1}'>", 
                name, id, value, ajaxUrl);
            var hidden = string.Format("<input type='hidden' name='{0}' value='{1}'>", name, value);
            var lableStr = string.Format("{1}</label>", id, text);
            var mvcHtmlString = MvcHtmlString.Create(string.Format("<label for='{0}'>{1}{2}</label>", id, checkBoxStr, text));
            return mvcHtmlString;
        }

        public static string Label(this HtmlHelper helper, string target, string text)
        {
            return string.Format("<label for='{0}'>{1}</label>", target, text);
        }
    }
}